//Allen Ott wrote this class
//Implmentatoin file
#include <iostream>
#include<string>
#include "character.h"

using namespace std;

Character :: Character(){
          
          x = 0;
          y = 0;
		  numItems = 0;
		  knapsack[0] = NULL;
		  knapsack[1] = NULL;
		  knapsack[2] = NULL;
          
}
//---------------------------------------------------------------------------------------------------
void Character :: addToKnapsack(Item* item){
	knapsack[numItems] = item;
	numItems++;     
}
//---------------------------------------------------------------------------------------------------
Item* Character :: removeFromKnapsack(){
	if(numItems > 0) {
		Item* ptr = knapsack[numItems - 1];
		knapsack[numItems - 1] = NULL;
		numItems--;
		return ptr;     
	}
	else {
		throw KnapsackEmptyException();
	}
}
//---------------------------------------------------------------------------------------------------
void Character :: setX(int xpos){
     x = xpos;

}
//---------------------------------------------------------------------------------------------------
int Character :: getX(){
    return x;
    
}
//---------------------------------------------------------------------------------------------------
void Character :: setY(int ypos){
     y = ypos;
     
}
//---------------------------------------------------------------------------------------------------
int Character :: getY(){
    return y;
}
//---------------------------------------------------------------------------------------------------
Item* Character :: getKnap(int size){
      return knapsack[size];  
}  
